package com.zm.demo.core.base;

import org.junit.Test;

import java.math.BigDecimal;

/**
 * @author z01140
 * @Package: com.zm.demo.core.base
 * @Description:
 * @CreateDate 2021/11/17 16:12
 * @UpdateDate 2021/11/17 16:12
 */
public class BigDecimalTest {

    @Test
    public void test(){
        BigDecimal b = new BigDecimal(-10L);
        BigDecimal b1 = new BigDecimal(10L);
        System.out.println(b.abs());
        System.out.println(b1.abs());
    }

    @Test
    public void testCompare(){
        BigDecimal b = new BigDecimal("10.00");
        BigDecimal b1 = new BigDecimal("10.0");
        System.out.println(b.equals(b1));
        System.out.println(b.compareTo(b1) == 0);
    }
}
